Ext.define('Hi.view.report.VRequestFiltersForm', {
    extend: 'Ext.form.Panel',
    defaultType: 'textfield',
    bodyStyle: 'padding: 5px',
    defaults: {
        labelWidth: 100        
    },
    itemCls: 'left-space-form',
    bodyCssClass: 'x-border-layout-ct',
    border: false,
    frame: true,    
    url: '/reports/getrequeststatusreport',
    anchor: '100%',
    layout: {
        type: 'table',
        columns: 2
    },
    items: [
        {
            xtype: 'label',            
            html: '<b>Seleccione un rango de fechas</b>',
            colspan: 2,
            align: 'center'
        },
        {
            xtype: 'datefield',
            fieldLabel: 'Fecha Inicial',
            name: 'dbeg',
            id: 'txtdbeg',
            format: 'd/m/Y',
            altFormats: 'Y-m-d'
        },
        {
            xtype: 'datefield',
            fieldLabel: 'Fecha Final',
            name: 'dend',
            id: 'txtdend',
            format: 'd/m/Y',
            margins: '0 0 0 10'
        }
    ],
    buttons: [
        {
            text: 'Reiniciar',
            iconCls: 'refresh',
            handler: function(){
                var grid = Ext.getCmp('RequestStatusGrid');
                var store = grid.getStore();
                store.load();
            }
        },
        {
            text: 'Filtrar',
            iconCls: 'find',
            handler: function(){
                var grid = Ext.getCmp('RequestStatusGrid');
                var store = grid.getStore();
                store.load({
                    params: {
                        dbeg: Ext.getCmp('txtdbeg').getValue(),
                        dend: Ext.getCmp('txtdend').getValue()
                    }
                });
            }
        }
    ]
});